<?php
class IndexController extends Controller {
	
	public function indexAction() {
		$newsItems = array();
		if($this->_session->isLogged()) {
			$user = $this->_session->getCurrent();
			if($user->isRoot()) {
				$newsItems = $this->_model->getNewsItems();
			}
			else {
				$newsItems = $this->_model->getVisibleNewsItems();
			}
			$this->_view->assign('isAdmin', $user->isRoot());
		}
		else {
			$newsItems = $this->_model->getVisibleNewsItems();
			$this->_view->assign('isAdmin', false);
		}
		$this->_view->assignArray(array(
			'pageTitle' => 'Localization system',
			'news' => $newsItems,
			'panel' => false,
			'pageId' => 'home'
		));
		$this->_view->render('index/index');
	}
	
	public function aboutAction() {
		$this->_view->assignArray(array(
			'pageTitle' => 'Localization system :: About',
			'panel' => false,
			'pageId' => 'about'
		));
		$this->_view->render('index/about');
	}
}
